# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Lucas Ramage <ramage.lucas@protonmail.com>
pkgname=efivar
pkgver=38
pkgrel=1
pkgdesc="Tools and library to manipulate EFI variables"
url="https://github.com/rhboot/efivar"
arch="all !s390x"
license="LGPL-2.1"
makedepends="popt-dev linux-headers mandoc"
subpackages="$pkgname-dev $pkgname-doc $pkgname-libs"
source="https://github.com/rhboot/efivar/releases/download/$pkgver/efivar-$pkgver.tar.bz2
	musl-compat.patch
	ppc64le-compat.patch
	fix-build-riscv64.patch
	"
builddir="$srcdir/efivar-$pkgver"

prepare() {
	default_prepare
	sed -i 's/#include <sys\/cdefs.h>//g' "$builddir/src/compiler.h"
}

build() {
	cd "$builddir"
	libdir="/usr/lib" make
}

package() {
	cd "$builddir"
	libdir="/usr/lib" make DESTDIR="$pkgdir" install
}

check() {
	LD_LIBRARY_PATH="$builddir"/src \
		"$builddir"/src/efivar --help > /dev/null
}
sha512sums="
c2f17297c863ece134a9dd758d237fd2df8c8d072f87af1d0bf2bcf9acfc7a53c25597f03fd4fb8cc664b205743d4ffa0ef1b068d0f73c58fa573d40993f3155  efivar-38.tar.bz2
1a1dfd66a5b613167eeedafe3f2728a0e644cb89860c3dad5955cbaba254ecde617e05d969eeac50be443d090136cbfec626f878f49eea2458b6b8ca17287bd4  musl-compat.patch
77e04d2df6797faef478bde4f591dc728a90ad27a55f4a26bb3b0f427a2dd31de0b97272a176e79880125fdc2cdd1eff184c9c80c4fedb40c4304f633691d13b  ppc64le-compat.patch
042dfb79b05032cbc9baad94a9ebf7e61e1bc5976e728287f96b426229a28e1c8dea2392ed262b2753ecac1b5146d6814cb2ecf44fdfa1e63e8e968c521f33ec  fix-build-riscv64.patch
"
